﻿using IFRS.Web;
using IFRS_Global;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IFRS.DataAccess.DAL;
using IFRS.Models;
using System.Globalization;
using System.Threading;
using vsm.CustomControl;

public partial class WIN31_GL_DEPO_3V : PageBase
{

    #region "---------- Events -----------"

    protected void Page_Load(object sender, EventArgs e)
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
        if (!(Page.IsPostBack || Page.IsCallback))
        {
            this.ViewMenu();
            if (Request.QueryString["id"] != null)
            {
                this.BindData(Convert.ToInt32(Request.QueryString["id"].ToString()));
            }
            SetControl();
        }
        else
            ClientScript.RegisterHiddenField("isPostBack", "1");
    }
    protected void btnCANCEL_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/IFRS/WIN31_1S.aspx");
    }
    #endregion "---------- Events -----------"

    #region "----------  Methods -----------"

    private void ViewMenu()
    {
        MenuTitleBar = Resources.ifrsMenu.WIN31_GL_DEPO_3V;
    }

    private void SetControl()
    {
        SetControlReadOnly(form_control);
    }

    private void BindData(int ID)
    {
        List<GLAccountPosting> glAccountPosting = new List<GLAccountPosting>();
        DataTable dt = new SPR_GLACCOUNTPOSTING().SEARCH_BYID(ID);
        if (dt.Rows.Count > 0)
        {
            ConvertHelper.ConvertDataTableToObject(dt, glAccountPosting);
            txtGL_Group.Text = glAccountPosting[0].GLGroup_NAME;
            txtGL_ACCOUNT.Text = glAccountPosting[0].GLAccount_CODE;
            txtGL_ACCOUNT_NAME.Text = glAccountPosting[0].GLAccount_NAME;
            txtGL_ADJ_CST_BS.Text = glAccountPosting[0].GL_ADJ_CST_BS_CODE;
            txtGL_ADJ_CST_BS_NAME.Text = glAccountPosting[0].GL_ADJ_CST_BS_NAME;
            txtGL_ADJ_FV_BS.Text = glAccountPosting[0].GL_ADJ_FV_BS_CODE;
            txtGL_ADJ_FV_BS_NAME.Text = glAccountPosting[0].GL_ADJ_FV_BS_NAME;
            txtGL_ADJ_INT_INC_ELCLS_PL.Text = glAccountPosting[0].GL_ADJ_INT_INC_ELCLS_PL_CODE;
            txtGL_ADJ_INT_INC_ELCLS_PL_NAME.Text = glAccountPosting[0].GL_ADJ_INT_INC_ELCLS_PL_NAME;
            txtGL_ADJ_INT_INC_PL.Text = glAccountPosting[0].GL_ADJ_INT_INC_PL_CODE;
            txtGL_ADJ_INT_INC_PL_NAME.Text = glAccountPosting[0].GL_ADJ_INT_INC_PL_NAME;
            txtGL_REV_CST_PL.Text = glAccountPosting[0].GL_REV_CST_PL_CODE;
            txtGL_REV_CST_PL_NAME.Text = glAccountPosting[0].GL_REV_CST_PL_NAME;

        }
    }
    #endregion "---------- Methods -----------"
  
}